
package com.sec.android.app.myfiles.feature;

import android.content.Context;
import android.os.Bundle;
import android.os.UserHandle;

import com.sec.android.app.myfiles.feature.knox.KnoxImp;
import com.sec.android.app.myfiles.log.Log;
import com.sec.android.app.myfiles.module.abstraction.FileRecord;
import com.sec.android.app.myfiles.provider.PrivateMyFilesProvider;

import java.util.ArrayList;
import java.util.List;

public class KnoxMgr {
    static KnoxMgr mSelf = null;
    public static final int TYPE_MOVE_TO_KNOX = 0;
    public static final int TYPE_MOVE_TO_SECURE_FOLDER = 1;
    public static final int TYPE_MOVE_TO_PERSONAL_MODE = 2;
    public static final int TYPE_REMOVE_FROM_SECURE_FOLDER = 3;
    public static final int TYPE_MOVE_TO_ENTERPRISE_CONTAINER = 4;
    public static final int TYPE_MAX = 5;
    public static final String ACTION_MOVE_BY_DND = "action_move_by_dnd";
    public static final String EXTRA_USER_ID = "extra_user_id";
    public static final String EXTRA_DEST_PATH = "extra_dest_path";

    private KnoxImp mKnoxImp;
    private Context mContext;

    public static KnoxMgr getInstance(Context context) {
        if (mSelf == null) {
            mSelf = new KnoxMgr(context);
        }

        return mSelf;
    }

    private KnoxMgr(Context context) {
        mContext = context;
        mKnoxImp = new KnoxImp(context);
    }

    public boolean isSupportSecureFolder() {
        boolean bRet = false;
        return bRet;
    }

    public boolean isKnoxNameChangeable() {
        return false;
    }

    private boolean isKnoxVersionSupported(int version) {
        boolean bRet = false;
        return bRet;
    }

    public void startMoveFiles(ArrayList<FileRecord> srcList, String destPath, int type) {
        if (mKnoxImp != null) {
            mKnoxImp.startMoveFiles(srcList, destPath, type);
            PrivateMyFilesProvider.clearCache(mContext, null);
        }
    }

    public boolean isKnoxModeOn() {
        boolean bRet = false;
        if (mKnoxImp != null) {
            bRet = mKnoxImp.isKnoxModeOn();
        }
        return bRet;
    }

    public boolean isSupportMove() {
        boolean bRet = false;
        if (mKnoxImp != null) {
            bRet = mKnoxImp.isSupportMove();
        }
        return bRet;
    }

    public boolean isLightWeightContainer() {
        boolean bRet = false;
        if (mKnoxImp != null) {
            bRet = mKnoxImp.isLightWeightContainer();
        }
        return bRet;
    }

    public boolean isSecureFolder() {
        boolean bRet = false;
        if (mKnoxImp != null) {
            bRet = mKnoxImp.isSecureFolder();
        }
        return bRet;
    }

    public boolean isInstallSecureFolder() {
        boolean bRet = false;
        if (mKnoxImp != null) {
            bRet = mKnoxImp.isInstallSecureFolder();
        }
        return bRet;
    }

    public String getKnoxName(int type) {
        String name = null;
        if (mKnoxImp != null) {
            name = mKnoxImp.getKnoxName(type);
        }
        return name;
    }

    public boolean isSupportExternalStorage() {
        return false;
    }

    public int getMoveType(int src, int dst) {
        Log.d(this, "getMoveType - " + src + " -> " + dst);
        int type = -1;
        return type;
    }

    public boolean isKnoxKeyguardShown(Context context) {
        return false;
    }
}
